<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>购物车checkbox选择</title>

    <script src="../js/jquery-1.11.0.min.js"></script>
    <script>
        $(function () {
            $(".all").click(function () {
                if ($(this).prop("checked")){
                    $(".select").prop("checked",true);
                }
            })

            $(".none").click(function () {

                    if ($(".none").index(i).prop("checked")){
                        $(".select").prop("checked",false);
                    }else {
                        $(".select").prop("checked",true);
                    }

            })
        })
    </script>
</head>
<body>
    <br>
    <br>
    <hr>
    <div align="center">
        <input type="checkbox" class="all" name="select" value="all">全选
        <input type="checkbox" class="select one" name="select" value="one">选项1
        <input type="checkbox" class="select two" name="select" value="two">选项2
        <input type="checkbox" class="select three" name="select" value="three">选项3
        <input type="checkbox" class="none" name="select" value="none">反选
    </div>




</body>
</html>